package com.example.myblog.service;

import com.example.myblog.mapper.UserMapper;
import com.example.myblog.model.ArticleInfo;
import com.example.myblog.model.UserInfo;
import org.springframework.stereotype.Service;
import sun.util.resources.cldr.te.TimeZoneNames_te;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Date:2022-10-28
 * Time:22:56
 *
 * @author 东莞呵呵
 */
@Service
public class UserService {
    @Resource
    private UserMapper userMapper;

    public int reg(UserInfo userInfo) {
        return userMapper.reg(userInfo);
    }

    public UserInfo login(UserInfo userInfo) {
        return userMapper.login(userInfo);
    }

    public List<ArticleInfo> index(Integer offsetSize, Integer pageSize) {
        return userMapper.index(offsetSize, pageSize);
    }

    public ArticleInfo getArtByAid(ArticleInfo articleInfo){
        return userMapper.getArtByAid(articleInfo);
    }

    public UserInfo getUserByAid(ArticleInfo articleInfo){
        return userMapper.getUserByAid(articleInfo);
    }

    public int readCountIncrease(ArticleInfo articleInfo){
        return userMapper.readCountIncrease(articleInfo);
    }

    public List<ArticleInfo> createArtList(UserInfo userInfo){
        return userMapper.getAllArtByUid(userInfo);
    }

    public int delArtByAid(ArticleInfo articleInfo){
        return userMapper.delArtByAid(articleInfo);
    }

    public int addArt(ArticleInfo articleInfo){
        return userMapper.addArt(articleInfo);
    }
}
